use std::thread;
use std::time::Duration;
use core::blockchain::BlockChain;
fn main() {
    let mut bc=BlockChain::new_blockchain();
    println!("produced genesis blockchain");

    println!("各节点矿工开始挖矿，打包区块，添加到账本");
    println!("start produce first block ...");
    thread::sleep(Duration::from_secs(3));
    let mut block1=vec![];
    block1.push(String::from("用户A账户给用户B账户转了1000元"));
    block1.push(String::from("用户A账户给用户C账户转了2000元"));
    bc.add_block(block1);

    println!("-------");
    println!("start produce second block ...");
    thread::sleep(Duration::from_secs(3));
    let mut block2=vec![];
    block2.push("用户B账户给用户C账户转了5000元".to_string());
    block2.push("用户B账户给用户D账户转了6000元".to_string());
    bc.add_block(block2);

    println!("*******");
    println!("产生的区块链：");
    for b in bc.blocks {
        println!("{:#?}",b);
    }
}
